package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysDistrictMapper;
import com.ruoyi.system.domain.SysDistrict;
import com.ruoyi.system.service.ISysDistrictService;
import com.ruoyi.common.core.text.Convert;

/**
 * 省市区街道信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-05-09
 */
@Service
public class SysDistrictServiceImpl implements ISysDistrictService 
{
    @Autowired
    private SysDistrictMapper sysDistrictMapper;

    /**
     * 查询省市区街道信息
     * 
     * @param id 省市区街道信息主键
     * @return 省市区街道信息
     */
    @Override
    public SysDistrict selectSysDistrictById(Long id)
    {
        return sysDistrictMapper.selectSysDistrictById(id);
    }

    /**
     * 查询省市区街道信息列表
     * 
     * @param sysDistrict 省市区街道信息
     * @return 省市区街道信息
     */
    @Override
    public List<SysDistrict> selectSysDistrictList(SysDistrict sysDistrict)
    {
        return sysDistrictMapper.selectSysDistrictList(sysDistrict);
    }

    /**
     * 新增省市区街道信息
     * 
     * @param sysDistrict 省市区街道信息
     * @return 结果
     */
    @Override
    public int insertSysDistrict(SysDistrict sysDistrict)
    {
        sysDistrict.setCreateTime(DateUtils.getNowDate());
        return sysDistrictMapper.insertSysDistrict(sysDistrict);
    }

    /**
     * 修改省市区街道信息
     * 
     * @param sysDistrict 省市区街道信息
     * @return 结果
     */
    @Override
    public int updateSysDistrict(SysDistrict sysDistrict)
    {
        sysDistrict.setUpdateTime(DateUtils.getNowDate());
        return sysDistrictMapper.updateSysDistrict(sysDistrict);
    }

    /**
     * 批量删除省市区街道信息
     * 
     * @param ids 需要删除的省市区街道信息主键
     * @return 结果
     */
    @Override
    public int deleteSysDistrictByIds(String ids)
    {
        return sysDistrictMapper.deleteSysDistrictByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除省市区街道信息信息
     * 
     * @param id 省市区街道信息主键
     * @return 结果
     */
    @Override
    public int deleteSysDistrictById(Long id)
    {
        return sysDistrictMapper.deleteSysDistrictById(id);
    }
}
